import { defineStore } from "pinia";
import defaultSettings from '@/utils/settings'

const { showSettings, fixedHeader, sidebarLogo } = defaultSettings

const useSettingStore = defineStore({
  id: 'settings',
  state: () => ({
    setting: {
      showSettings: showSettings,
      fixedHeader: fixedHeader,
      sidebarLogo: sidebarLogo
    }
  }),
  actions: {
    changeSetting ({ key, value }) {
      if(this.setting.hasOwnProperty(key)) {
        this.setting[key] = value
      }
    }
  }
})

export default useSettingStore